package com.frost.aop.proxy;

public class HouseProxy implements HouseSubject {
    // 目标类
    private HouseSubject houseSubject;

    public HouseProxy(HouseSubject houseSubject) {
        this.houseSubject = houseSubject;
    }

    /**
     * 调用目标方法并对方法增强
     */
    @Override
    public void rentHouse() {
        System.out.println("我是中介,我开始代理房东出租房子...");
        houseSubject.rentHouse();
        System.out.println("我是中介,我代理房东出租房子结束...");
    }

    @Override
    public void saleHouse() {
        System.out.println("我是中介,我开始代理房东出售房子...");
        houseSubject.rentHouse();
        System.out.println("我是中介,我代理房东出售房子结束...");
    }
}
